package com.example.springboot.config.zookeeper;

import org.apache.curator.framework.CuratorFramework;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/5/24 14:27
 */
// @Component
public class StartZookeeper implements CommandLineRunner {
    @Autowired
    private CuratorFramework client;
    @Autowired
    private ZookeeperListener zookeeperListener;

    @Override
    public void run(String... args) throws Exception {
        // 启动
        client.start();
        System.out.println("Apache curator客户端启动了");
        // 启动文件监听
        zookeeperListener.listen();
    }
}
